<script lang="ts" setup>
import { onMounted } from 'vue';
import useStore from '../store';

const { channel, newsList } = useStore()
channel.getChannelList()

// 组件加载时,手动点击第一个频道
onMounted(() => {
  hClick(0)
})

const hClick = (id: number) => {
  // getNewsList
  channel.setCurId(id)
  newsList.getNewsList(id)
}
</script>

<template>
  <ul class="catagtory">
    <!-- <li class="select">开发者资讯</li> -->
    
    <li
      v-for="item in channel.list"
      :class="{select: item.id===channel.curId}"
      @click="hClick(item.id)"
      :key="item.id">{{item.name}}</li>
  </ul>
</template>

<style scoed lang="less"></style>